var exec = require('cordova/exec');

var adapt = function () {

}

adapt.prototype.error_callback = function (msg) {
  console.log('Adapt Callback Error: ' + msg)
}

adapt.prototype.call_native = function (name, args, callback) {
  ret = cordova.exec(callback, this.error_callback, 'Adapt', name, args)
  return ret
}

adapt.prototype.init = function (args, callback) {
  this.call_native("initial", [args], callback)
}

adapt.prototype.coolMethod = function (args, callback) {
  this.call_native("coolMethod", [args], callback)
}

adapt.prototype.tokenAdd = function (args, callback) {
  this.call_native("tokenAdd", [args], callback)
}

adapt.prototype.tokenRemove = function (args, callback) {
  this.call_native("tokenRemove", [], callback)
}

if (!window.plugins) {
  window.plugins = {}
}

if (!window.plugins.adapt) {
  window.plugins.adapt = new adapt()
}

module.exports = new adapt()
